// 更新用户信息
let emailUrl = 'ido/app/user/profile/email'
let phoneNumberUrl = 'ido/app/user/profile/phoneNumber'
let sexUrl = 'ido/app/user/profile/sex'
let avatarUrl = 'system/user/profile/avatar'
let pwdUrl = 'ido/app/user/profile/updatePwd'
// 学生选择企业
let enterpriseSelect = 'ido/app/user/profile/student/enterpriseId'
// 点击退出登录时的断开服务器连接
let quitUrl = 'logout'

function updateUserApi(vm) {

	// 更新用户邮箱
	let changeEmail = (email = '', params = {}) => vm.$u.put(emailUrl + '?' + email, params)
	let changePhoneNumber = (phone = '', params = {}) => vm.$u.put(phoneNumberUrl + '?' + phone, params)
	let changeSex = (sex = '', params = {}) => vm.$u.put(sexUrl + '?' + sex, params)
	// 这个上传头像的接口可能不会使用
	let changeAvatar = (params = {}) => vm.$u.post(avatarUrl, params)
	let changePwd = (params = {}) => vm.$u.put(pwdUrl, params)
	// 按照企业ID来选择企业
	let selectEnterprise = (id) => vm.$u.post(enterpriseSelect + "?enterpriseId=" + id)
	let quit = () => vm.$u.post(quitUrl)
	return {
		changeEmail,
		changePhoneNumber,
		changeSex,
		changeAvatar,
		changePwd,
		selectEnterprise,
		quit
	}
}
export default updateUserApi
